package com.kede.api.stand.controller.store;

import com.kede.api.stand.service.StoreService;
import com.kede.api.stand.service.SupplieManageService;
import com.kede.pojo.ResHttp;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 独立服务
 *
 * @author 11856
 * @date 2023/06/12
 */
@RequestMapping("storeIndex")
@RestController
public class StoreController {
    @Resource
    private SupplieManageService supplieManageService;

    @Resource
    private StoreService storeService;

    /**
     * 获取拥有商品的门店
     * @param lng
     * @param lat
     * @return
     */
    @GetMapping("getStoreSupplie")
    public ResHttp getStoreSupplie(String lng, String lat){
        return supplieManageService.getStoreSupple(lng, lat);
    }

    /**
     * 用户获取门店中的商品物资
     * @param storeId
     * @return
     */
    @GetMapping("getStoreProduct")
    public ResHttp getStoreProduct(Integer storeId,Integer userId){
        return supplieManageService.getStoreProduct(storeId,userId);
    }

    /**
     * 门店获取自己的商品物资
     * @param storeId
     * @return
     */
    @GetMapping("getStoreProductByStore")
    public ResHttp getStoreProductByStore(Integer storeId){
        return supplieManageService.getStoreProductByStore(storeId);
    }

    /**
     * 根据openid获取门店信息
     *
     * @param openid openid
     * @return {@link ResHttp}
     */
    @GetMapping("getStoreInfoByOpenid")
    public ResHttp getStoreInfoByOpenid(String openid){
        return storeService.getStoreInfoByOpenid(openid);
    }

}
